<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>微信支付</title>
</head>
<body style="text-align: center;">
<script src="__JS__/js/jquery-1.7.min.js" type="text/javascript"></script>
<!-- <button onclick="getOrder()">购买</button> -->


<jquery />
<script>

function onBridgeReady(){
    var data={$data};
    var state={$_GET['state']};
    WeixinJSBridge.invoke(
        'getBrandWCPayRequest', data,
        function(res){
            if(res.err_msg == "get_brand_wcpay_request:ok" ) {
                // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回ok，但并不保证它绝对可靠。
                // alert(window.location.href);
                // alert(state);
                window.location.href="http://www.quanminjiaoxue.com/index.php/Home/Wxpay/notify_s/order/"+state;
            }else{
                alert('支付失败');
                window.location.href="http://www.quanminjiaoxue.com/index.php/Home/Account/recharge/";
                // alert(res.err_code+res.err_desc+res.err_msg); // 显示错误信息
            }
        }
    );
}

 if (typeof WeixinJSBridge == "undefined"){
     if( document.addEventListener ){
         document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
     }else if (document.attachEvent){
         document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
         document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
     }
 }else{
      onBridgeReady();
 }

</script>
</body>
</html>